// : v.book.read.tip.state.demo1.Creature.java
package v.book.read.tip.state.demo1;

import junit.framework.TestCase;

/**
 * 不用状态模式所产生的问题
 * <code>Creature.greet()</code>方法会越来越臃肿。
 * @author 小败
 */
class Creature {
    private boolean isFrog = true;

    public void greet() {
        if (isFrog)
            System.out.println("Ribbet!");
        else
            System.out.println("Darling!");
    }

    public void kiss() {
        isFrog = false;
    }
}

public class KissingPrincess extends TestCase {
    Creature creature = new Creature();

    public void test() {
        creature.greet();
        creature.kiss();
        creature.greet();
    }

    public static void main(String args[]) {
        junit.textui.TestRunner.run(KissingPrincess.class);
    }
}
